


public class PowerFunction extends Function{
	
	{
		order = 2;
	}

	public double evaluate(double[] vars){
		double first = children.get(0).evaluate(vars);
		double second = children.get(1).evaluate(vars);
		
		if (first < 0)
			second = (int) second;
		return Math.pow(first, second);
	}

	public PowerFunction deepCopy(){
		PowerFunction returner = new PowerFunction();
		for(Node myChild:this.children){
			returner.children.add(myChild.deepCopy());
		}
		for(Node otherChild:returner.children){
			otherChild.parent = returner;
		}
		returner.size = this.size;
		return returner;
	}
	
	public String toString() {
		return "("+this.children.get(0)+"^"+this.children.get(1)+" )";
	}
}